#pragma once

#include <iostream>
#include <ctime>
#include <cstdlib>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
using namespace std;

#define TaskNum 3

typedef void(*task_t)();

task_t tasks[TaskNum];

void Print()
{
    cout << "I an Print task" << endl;
}

void Download()
{
    cout << "I am download task" << endl;
}

void Flush()
{
    cout << "I am flush task" << endl;
}

void Inittask()
{
    srand(time(nullptr) ^ getpid());
    tasks[0] = Print;
    tasks[1] = Download;
    tasks[2] = Flush;
}

void Excutetask(int number)
{
    if(number > 2 || number < 0) return;

    tasks[number]();
}

int Selecttask()
{
    return rand() % TaskNum;
}